package com.example.controller;

import com.example.rocketmq.Producer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: yll
 * @Description: 消息队列
 * @Date: 2020/9/16 12:20 上午
 * @Version: 1.0
 */
@RestController
@RequestMapping("/rocket")
@Api(tags = "rocket 测试API")
public class RocketMqController {
    @Autowired
    private Producer producer;

    @GetMapping("send/{msg}")
    @ApiOperation(value="根据key获取缓存")
    public void sendMsg(@PathVariable("msg") String msg) {
        producer.sendMsg(msg);
        System.out.println("发送成功");
    }
}
